import React from 'react'
import {Row,Col,Form,Input,Typography,Select, Button}from "antd"
import { ajax } from '../../api'
import { observer } from 'mobx-react'
import myinfo from '../../mobx/info'
import { toast } from '../../utils/commom'
const {Title}=Typography
function Freeadd({history}:any) {
    const {userInfo}=myinfo
     const onFinish= async(value:any)=>{
         value.userInfo=userInfo
         let {code,result}:any =await ajax.addshoufei(value)
         if(code==200){
            history.push("/main/free/list")
         }

     }
     const onFinishFailed=()=>{
        toast.error("请输入有效的信息")
     }
     const [form]=Form.useForm()    
     return (
        <div>
          <Title level={4}>添加收费项目名称</Title>
          <Row>
                <Col>
                    <Form
                        name="basic"
                        labelCol={{ span: 24 }}
                        wrapperCol={{ span: 24 }}
                        initialValues={{ password: "qwe123" }}
                        onFinish={onFinish}
                        onFinishFailed={onFinishFailed}
                        autoComplete="off"
                        form={form}
                    >
                        <Form.Item
                            label="项目标题"
                            name="title"
                            rules={[{ required: true, message: '请输入项目标题!' }]}
                        >
                            <Input placeholder="请输入项目标题" />
                        </Form.Item>

                        <Form.Item
                            label="项目标准内容"
                            name="content"
                            rules={[{ required: true, message: '请输入项目标准内容!' }]}
                        >
                            <Input.TextArea cols={10} rows={10} placeholder="请输入项目标准内容" />
                        </Form.Item>

                        <Form.Item
                            label="项目备注"
                            name="remarks"
                            rules={[{ required: true, message: '请输入项目备注!' }]}
                        >
                            <Input placeholder="请输入项目备注" />
                        </Form.Item>


                        <Form.Item>
                            <Row>
                                <Col span={24} >
                                    <Button type="primary" block htmlType="submit"  > 添加维修内容 </Button>
                                </Col>

                            </Row>
                        </Form.Item>
                    </Form>
                </Col>
            </Row>
        </div>
    )
}
export default  observer(Freeadd)